<template>
  <div class="home-box">
    <h1>Home标签demo</h1>
    <hr />
    <button @click="gotoPush">通过push跳转到电影1页</button>
    <button @click="gotoReplace">通过replace跳转到电影1页</button>
    <button @click="gotoGo">浏览历史后退</button>

    <router-link to="/main">访问后台主页</router-link>
  </div>
</template>

<script>
export default {
  methods: {
    gotoPush() {
      // 跳到指定的hash地址，增加一条记录
      this.$router.push("/movie/movieInfo/2");
    },
    gotoReplace() {
      // 不添加历史记录
      this.$router.replace("/movie/movieInfo/2");
    },
    gotoGo() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="less" scoped>
.home-box {
  background-color: pink;
  height: 200px;
}
</style>